//////////////////////////////////////////////////////////////////////////
// PeekPocket - the hassle-free WiFi scanner for Windows Mobile
// coded by dzolee
// http://dzolee.blogspot.com
//
// OptionsDlg - this is the options tab
//////////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "PeekPocket.h"
#include "OptionsDlg.h"
#include "PPDlg.h"

extern CSettingsStorage g_Settings;
extern CTextCache g_Texts;

// COptionsDlg dialog
IMPLEMENT_DYNAMIC(COptionsDlg, CColoredDlg)

//////////////////////////////////////////////////////////////////////////
COptionsDlg::COptionsDlg(CWnd* pParent /*=NULL*/)
	: CColoredDlg(COptionsDlg::IDD, pParent)
	, m_staticUseAdapter(_T(""))
	, m_staticScanSpeed(_T(""))
	, m_staticListFontSize(_T(""))
{
}

//////////////////////////////////////////////////////////////////////////
COptionsDlg::~COptionsDlg()
{
}

//////////////////////////////////////////////////////////////////////////
void COptionsDlg::DoDataExchange(CDataExchange* pDX)
{
	CColoredDlg::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_ADAPTERS_COMBO, m_adapters);
	DDX_Control(pDX, IDC_SCANSPEED_SLIDER, m_speed);
	DDX_Control(pDX, IDC_HIDE_PEERS, m_hidepeers);
	DDX_Control(pDX, IDC_HIDE_SEC, m_hidesec);
	DDX_Control(pDX, IDC_SOUND_OFF, m_soundoff);
	DDX_Text(pDX, IDC_SCANTIME, m_strScanSpeed);
	DDX_Control(pDX, IDC_FONTSIZE_SLIDER, m_fontsize);
	DDX_Control(pDX, IDC_ABOUT_BTN, m_btnAbout);
	DDX_Text(pDX, IDC_STATIC_USEADAPTER, m_staticUseAdapter);
	DDX_Text(pDX, IDC_STATIC_SCANSPEED, m_staticScanSpeed);
	DDX_Text(pDX, IDC_STATIC_LISTFONTSIZE, m_staticListFontSize);
	DDX_Control(pDX, IDC_LANG_BTN, m_btnLang);
}


BEGIN_MESSAGE_MAP(COptionsDlg, CColoredDlg)
	ON_WM_HSCROLL()
	ON_BN_CLICKED(IDC_HIDE_PEERS, &COptionsDlg::OnBnClickedHidePeers)
	ON_BN_CLICKED(IDC_HIDE_SEC, &COptionsDlg::OnBnClickedHideSec)
	ON_BN_CLICKED(IDC_SOUND_OFF, &COptionsDlg::OnBnClickedSoundOn)
	ON_WM_PAINT()
	ON_BN_CLICKED(IDC_ABOUT_BTN, &COptionsDlg::OnBnClickedAboutBtn)
	ON_BN_CLICKED(IDC_LANG_BTN, &COptionsDlg::OnBnClickedLangBtn)
	ON_COMMAND(ID_LANG_EN, &COptionsDlg::OnLangEn)
	ON_COMMAND(ID_LANG_HU, &COptionsDlg::OnLangHu)
	ON_COMMAND(ID_LANG_FR, &COptionsDlg::OnLangFr)
	ON_COMMAND(ID_LANG_PL, &COptionsDlg::OnLangPl)
	ON_COMMAND(ID_LANG_PT, &COptionsDlg::OnLangPt)
	ON_COMMAND(ID_LANG_RU, &COptionsDlg::OnLangRu)
	ON_COMMAND(ID_LANG_DE, &COptionsDlg::OnLangDe)
	ON_COMMAND(ID_LANG_NL, &COptionsDlg::OnLangNl)
	ON_COMMAND(ID_LANG_CZ, &COptionsDlg::OnLangCz)
	ON_COMMAND(ID_LANG_IT, &COptionsDlg::OnLangIt)
	ON_COMMAND(ID_LANG_DK, &COptionsDlg::OnLangDk)
	ON_COMMAND(ID_LANG_NO, &COptionsDlg::OnLangNo)
	ON_COMMAND(ID_LANG_SE, &COptionsDlg::OnLangSe)
	ON_COMMAND(ID_LANG_ES, &COptionsDlg::OnLangEs)
END_MESSAGE_MAP()

// COptionsDlg message handlers

//////////////////////////////////////////////////////////////////////////
BOOL COptionsDlg::OnInitDialog()
{
int nH;
CRect rc;
CPoint pt;
HBITMAP hBmpCh, hBmpTI, hBmpTA, hBmpL1, hBmpL2, hBmpS1, hBmpS2, hBmpP1, hBmpP2, hBmpAb, hBmpLang;
DWORD dwTemp;

	CColoredDlg::OnInitDialog();

	//create font for buttons/checkboxes
	m_Font.CreateFont(12, 0, 0, 0, FW_NORMAL, 0, 0, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, _T("Tahoma"));

	//init static texts
	m_staticUseAdapter=g_Texts.GetString(teUseAdapter) + _T(":");
	m_staticScanSpeed=g_Texts.GetString(teScanSpeed) + _T(":");
	m_staticListFontSize=g_Texts.GetString(teListFontSize) + _T(":");

	//set the dropped-down width of the combo
	CWnd *pcombo=GetDlgItem(IDC_ADAPTERS_COMBO);
	if(pcombo!=NULL)
	{
		nH=pcombo->SendMessage(CB_GETITEMHEIGHT);
		nH*=6;  //number of visible items+2
		pcombo->GetWindowRect(&rc);
		pt.x=rc.left; pt.y=rc.top;
		ScreenToClient(&pt);
		pcombo->MoveWindow(pt.x, pt.y, rc.Width(), nH);
	}

	//init speed slider

	//first resize to 30x80 px - size of bitmap used
	m_speed.GetWindowRect(&rc);
	pt.x=rc.left; pt.y=rc.top;
	rc.right=rc.left+80;		//width
	rc.bottom=rc.top+30;		//height
	ScreenToClient(&pt);
	m_speed.MoveWindow(pt.x, pt.y, rc.Width(), rc.Height());

	//setup range
	m_speed.SetRange(1, 5);
	m_speed.SetReverse(true);

	g_Settings.GetNumeric(nseScanSpeed, dwTemp);
	if(dwTemp < 1 || dwTemp > 5)
	{
		dwTemp = 2;
	}
	m_speed.SetPos(dwTemp);
	//textual representation of scan speed
	CreateScanSpeedText(dwTemp);
	
	//setup color/bitmaps
	m_speed.SetBkgColor(RGB_AVERAGE(GetSysColor(COLOR_ACTIVECAPTION), RGB(255, 255, 255)));

	hBmpCh=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_CHANNEL));
	hBmpTI=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_THUMBI));
	hBmpTA=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_THUMBA));
	m_speed.SetBitmaps(hBmpCh, hBmpTI, hBmpTA);
	

	//init fontsize slider

	//first resize to 30x80 px - size of bitmap used
	m_fontsize.GetWindowRect(&rc);
	pt.x=rc.left; pt.y=rc.top;
	rc.right=rc.left+80;		//width
	rc.bottom=rc.top+30;		//height
	ScreenToClient(&pt);
	m_fontsize.MoveWindow(pt.x, pt.y, rc.Width(), rc.Height());

	//setup range
	m_fontsize.SetRange(10, 20);
	g_Settings.GetNumeric(nseFontSize, dwTemp);
	if(dwTemp > 20)
	{
		dwTemp = 12;
	}
	m_fontsize.SetPos(dwTemp);

	//setup color/bitmaps
	m_fontsize.SetBkgColor(RGB_AVERAGE(GetSysColor(COLOR_ACTIVECAPTION), RGB(255, 255, 255)));

	hBmpCh=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_CHANNEL));
	hBmpTI=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_THUMBI));
	hBmpTA=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_THUMBA));
	m_fontsize.SetBitmaps(hBmpCh, hBmpTI, hBmpTA);

	//init checkboxes
	m_hidepeers.SetCaption(g_Texts.GetString(teShowPeers), g_Texts.GetString(teHidePeers));
	m_hidepeers.SetBkgIdleColor(RGB_AVERAGE(GetSysColor(COLOR_ACTIVECAPTION), RGB(255, 255, 255)));
	m_hidepeers.SetBkgActiveColor(RGB_AVERAGE(GetSysColor(COLOR_ACTIVECAPTION), RGB(255, 255, 255)));
	hBmpP1=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_PEER));
	hBmpP2=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_HIDE_PEER));
	m_hidepeers.SetBitmaps(hBmpP1, hBmpP2);
	m_hidepeers.SetFont(m_Font);

	g_Settings.GetNumeric(nseHidePeer, dwTemp);
	m_hidepeers.SetCheck(dwTemp == 0 ? BST_UNCHECKED : BST_CHECKED);

	m_hidesec.SetCaption(g_Texts.GetString(teShowSecure), g_Texts.GetString(teHideSecure));
	m_hidesec.SetBkgIdleColor(RGB_AVERAGE(GetSysColor(COLOR_ACTIVECAPTION), RGB(255, 255, 255)));
	m_hidesec.SetBkgActiveColor(RGB_AVERAGE(GetSysColor(COLOR_ACTIVECAPTION), RGB(255, 255, 255)));
	hBmpL1=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_LOCK));
	hBmpL2=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_LOCK_C));
	m_hidesec.SetBitmaps(hBmpL1, hBmpL2);
	m_hidesec.SetFont(m_Font);

	g_Settings.GetNumeric(nseHideWEP, dwTemp);
	m_hidesec.SetCheck(dwTemp == 0 ? BST_UNCHECKED : BST_CHECKED);

	m_soundoff.SetCaption(g_Texts.GetString(teSoundOn), g_Texts.GetString(teSoundOff));
	m_soundoff.SetBkgIdleColor(RGB_AVERAGE(GetSysColor(COLOR_ACTIVECAPTION), RGB(255, 255, 255)));
	m_soundoff.SetBkgActiveColor(RGB_AVERAGE(GetSysColor(COLOR_ACTIVECAPTION), RGB(255, 255, 255)));
	hBmpS1=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_SND_ON));
	hBmpS2=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_SND_OFF));
	m_soundoff.SetBitmaps(hBmpS1, hBmpS2);
	m_soundoff.SetFont(m_Font);

	g_Settings.GetNumeric(nseSoundOff, dwTemp);	
	m_soundoff.SetCheck(dwTemp == 0 ? BST_UNCHECKED : BST_CHECKED);

	//init about btn
	m_btnAbout.SetBkgIdleColor(RGB_AVERAGE(GetSysColor(COLOR_ACTIVECAPTION), RGB(255, 255, 255)));
	m_btnAbout.SetBkgActiveColor(RGB_AVERAGE(GetSysColor(COLOR_ACTIVECAPTION), RGB(255, 255, 255)));
	hBmpAb=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_INFO));
	m_btnAbout.SetBitmaps(hBmpAb);

	//init language selection button
	m_btnLang.SetBkgIdleColor(RGB_AVERAGE(GetSysColor(COLOR_ACTIVECAPTION), RGB(255, 255, 255)));
	m_btnLang.SetBkgActiveColor(RGB_AVERAGE(GetSysColor(COLOR_ACTIVECAPTION), RGB(255, 255, 255)));

	//get current lang ID
	g_Settings.GetNumeric(nseLanguage, dwTemp);

	switch(dwTemp)
	{
		case lePolish:
		{
			hBmpLang=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_FLAG_PL));
			break;
		}
		case lePortuguese:
		{
			hBmpLang=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_FLAG_PT));
			break;
		}
		case leHungarian:
		{
			hBmpLang=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_FLAG_HU));
			break;
		}
		case leFrench:
		{
			hBmpLang=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_FLAG_FR));
			break;
		}
		case leRussian:
		{
			hBmpLang=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_FLAG_RU));
			break;
		}
		case leGerman:
		{
			hBmpLang=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_FLAG_DE));
			break;
		}
		case leDutch:
		{
			hBmpLang=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_FLAG_NL));
			break;
		}
		case leItalian:
		{
			hBmpLang=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_FLAG_IT));
			break;
		}
		case leCzech:
		{
			hBmpLang=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_FLAG_CZ));
			break;
		}
		case leDanish:
		{
			hBmpLang=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_FLAG_DK));
			break;
		}
		case leNorwegian:
		{
			hBmpLang=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_FLAG_NO));
			break;
		}
		case leSwedish:
		{
			hBmpLang=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_FLAG_SE));
			break;
		}
		case leSpanish:
		{
			hBmpLang=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_FLAG_ES));
			break;
		}
		//english is the default case
		case leEnglish:
		default:
		{
			hBmpLang=::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_FLAG_GB));
			break;
		}
	}

	m_btnLang.SetBitmaps(hBmpLang);

	UpdateData(FALSE);
	return TRUE;
}

//////////////////////////////////////////////////////////////////////////
//handle slider events
void COptionsDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
	//is the sender a CCustomSlider?
	if(pScrollBar != NULL && pScrollBar->IsKindOf(RUNTIME_CLASS(CCustomSlider)))
	{
		//yes, which slider was it?
		switch(pScrollBar->GetDlgCtrlID())
		{
			case IDC_SCANSPEED_SLIDER:
			{
				CreateScanSpeedText(nPos);
				UpdateData(FALSE);
				g_Settings.SetNumeric(nseScanSpeed, nPos);
				break;
			}//case scanspeed slider
			case IDC_FONTSIZE_SLIDER:
			{
				DrawListFontSizeText();
				g_Settings.SetNumeric(nseFontSize, nPos);
				//update immediately
				CWnd *pParent;
				pParent=GetParent();
				if(pParent != NULL)
				{
					((CPPDlg *)pParent)->m_pScannerDlg->SetListFont(nPos);
				}
				break;
			}//case fontsize slider
		}
	}
}

//////////////////////////////////////////////////////////////////////////
void COptionsDlg::OnPaint()
{
	CColoredDlg::OnPaint();

	DrawListFontSizeText();
}

//////////////////////////////////////////////////////////////////////////
//draw list font selection text
void COptionsDlg::DrawListFontSizeText()
{
HGDIOBJ hOldObj;
CString str;
CFont font;
CRect rc;

	CDC *pDC=GetDC();
	if(pDC != NULL)
	{
		font.CreateFont(m_fontsize.GetPos(), 0, 0, 0, FW_BOLD, FALSE /*italic*/, FALSE /*underline*/, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, _T("Tahoma")) ;

		hOldObj=pDC->SelectObject(font);

		str.Format(_T("%d"), m_fontsize.GetPos());

		//let the dialog setup colors in DC
		SendMessage(WM_CTLCOLORSTATIC, (WPARAM)pDC->GetSafeHdc(), -1);

		rc.SetRect(175, 67, 200, 92);
		pDC->FillSolidRect(rc, pDC->GetBkColor());

		//center the text
		pDC->DrawText(str, rc, DT_CENTER | DT_VCENTER | DT_SINGLELINE);

		pDC->SelectObject(hOldObj);
		ReleaseDC(pDC);
	}
}

//////////////////////////////////////////////////////////////////////////
//set option
void COptionsDlg::OnBnClickedHidePeers()
{
bool bOption;

	bOption=(m_hidepeers.GetCheck() == BST_CHECKED);

	//store option
	g_Settings.SetNumeric(nseHidePeer, bOption ? 1:0);

	//since this might have removed some from the list, kick the scanner
	CWnd *pParent;
	pParent=GetParent();
	if(pParent != NULL)
	{
		((CPPDlg *)pParent)->m_pScannerDlg->ReturnToNormalMode();
	}
}

//////////////////////////////////////////////////////////////////////////
//set option
void COptionsDlg::OnBnClickedHideSec()
{
bool bOption;

	bOption=(m_hidesec.GetCheck() == BST_CHECKED);

	//store option
	g_Settings.SetNumeric(nseHideWEP, bOption ? 1:0);

	//since this might have removed some from the list, kick the scanner
	CWnd *pParent;
	pParent=GetParent();
	if(pParent != NULL)
	{
		((CPPDlg *)pParent)->m_pScannerDlg->ReturnToNormalMode();
	}
}

//////////////////////////////////////////////////////////////////////////
//set option
void COptionsDlg::OnBnClickedSoundOn()
{
bool bOption;

	bOption=(m_soundoff.GetCheck() == BST_CHECKED);

	//store option
	g_Settings.SetNumeric(nseSoundOff, bOption ? 1:0);
}

//////////////////////////////////////////////////////////////////////////
//popup about message
void COptionsDlg::OnBnClickedAboutBtn()
{
#ifdef _DEBUG
	AfxMessageBox(_T("PeekPocket 1.6\nTest version\ndo not distribute!"), MB_ICONEXCLAMATION);
#else
	AfxMessageBox(_T("PeekPocket 1.6\nFree WiFi scanner\ndzolee.blogspot.com"), MB_ICONINFORMATION);
#endif
}

//////////////////////////////////////////////////////////////////////////
void COptionsDlg::CreateScanSpeedText(int sp)
{
	switch(sp)
	{
		case 5:
		{
			m_strScanSpeed=g_Texts.GetString(teSlowest);
			break;
		}
		case 4:
		{
			m_strScanSpeed=g_Texts.GetString(teSlow);
			break;
		}
		case 3:
		{
			m_strScanSpeed=g_Texts.GetString(teNormal);
			break;
		}
		case 2:
		{
			m_strScanSpeed=g_Texts.GetString(teFast);
			break;
		}
		case 1:
		{
			m_strScanSpeed=g_Texts.GetString(teFastest);
			break;
		}
	}//switch slider pos
}

void COptionsDlg::OnBnClickedLangBtn()
{
CMenu popup, *subitem;
CRect rc;
CPoint pt;
DWORD dwTemp;
//MENUITEMINFO mi;

	m_btnLang.GetWindowRect(rc);
	pt=rc.TopLeft();

	if(FALSE != popup.LoadMenu(IDR_MENU_LANG))
	{
		subitem = popup.GetSubMenu(0);

		//delete current language from menu
		g_Settings.GetNumeric(nseLanguage, dwTemp);
		switch(dwTemp)
		{
			case leFrench:
			{
				dwTemp=ID_LANG_FR;
				break;
			}
			case leHungarian:
			{
				dwTemp=ID_LANG_HU;
				break;
			}
			case lePolish:
			{
				dwTemp=ID_LANG_PL;
				break;
			}
			case lePortuguese:
			{
				dwTemp=ID_LANG_PT;
				break;
			}
			case leRussian:
			{
				dwTemp=ID_LANG_RU;
				break;
			}
			case leGerman:
			{
				dwTemp=ID_LANG_DE;
				break;
			}
			case leDutch:
			{
				dwTemp=ID_LANG_NL;
				break;
			}
			case leCzech:
			{
				dwTemp=ID_LANG_CZ;
				break;
			}
			case leItalian:
			{
				dwTemp=ID_LANG_IT;
				break;
			}
			case leDanish:
			{
				dwTemp=ID_LANG_DK;
				break;
			}
			case leSwedish:
			{
				dwTemp=ID_LANG_SE;
				break;
			}
			case leNorwegian:
			{
				dwTemp=ID_LANG_NO;
				break;
			}
			case leSpanish:
			{
				dwTemp=ID_LANG_ES;
				break;
			}

			case leEnglish:
			default:
			{
				dwTemp=ID_LANG_EN;
				break;
			}
		}
		subitem->DeleteMenu(dwTemp, MF_BYCOMMAND);

	/*
		//setup small flags for menu items
		mi.cbSize=sizeof(MENUITEMINFO);
		mi.fMask=MIIM_CHECKMARKS;
		mi.fType=MFT_STRING;
		mi.fState=MFS_ENABLED;
		mi.wID=ID_LANG_EN;
		mi.hSubMenu=0;
		mi.hbmpUnchecked=m_hBmpGB;
		mi.hbmpChecked=0;
		mi.dwItemData=0;
		mi.dwTypeData=0;
		mi.cch=0;

		if(FALSE == subitem->SetMenuItemInfo(1, &mi, TRUE))
		{
			GetLastError();
		}
	*/
		subitem->TrackPopupMenu(TPM_BOTTOMALIGN, pt.x, pt.y, this);
	}//if load menu ok
}

//////////////////////////////////////////////////////////////////////////
bool COptionsDlg::ConfirmLangChange(CString strLang)
{
	if(IDYES == AfxMessageBox(_T("Are you sure you want to change program language to ") + strLang + _T("?"), MB_YESNO | MB_ICONQUESTION))
	{
		return true;
	}
	return false;
}

//////////////////////////////////////////////////////////////////////////
void COptionsDlg::LangChangedMsg()
{
	AfxMessageBox(_T("Program language changed. Restart the application for the change to take effect."), MB_ICONINFORMATION);
}

//////////////////////////////////////////////////////////////////////////
void COptionsDlg::OnLangEn()
{
	if(ConfirmLangChange(_T("english")) == true)
	{
		g_Settings.SetNumeric(nseLanguage, (DWORD)leEnglish);
		LangChangedMsg();
	}
}

//////////////////////////////////////////////////////////////////////////
void COptionsDlg::OnLangHu()
{
	if(ConfirmLangChange(_T("hungarian")) == true)
	{
		g_Settings.SetNumeric(nseLanguage, (DWORD)leHungarian);
		LangChangedMsg();
	}
}

//////////////////////////////////////////////////////////////////////////
void COptionsDlg::OnLangFr()
{
	if(ConfirmLangChange(_T("french")) == true)
	{
		g_Settings.SetNumeric(nseLanguage, (DWORD)leFrench);
		LangChangedMsg();
	}
}

//////////////////////////////////////////////////////////////////////////
void COptionsDlg::OnLangPl()
{
	if(ConfirmLangChange(_T("polish")) == true)
	{
		g_Settings.SetNumeric(nseLanguage, (DWORD)lePolish);
		LangChangedMsg();
	}
}

//////////////////////////////////////////////////////////////////////////
void COptionsDlg::OnLangPt()
{
	if(ConfirmLangChange(_T("portuguese")) == true)
	{
		g_Settings.SetNumeric(nseLanguage, (DWORD)lePortuguese);
		LangChangedMsg();
	}
}

//////////////////////////////////////////////////////////////////////////
void COptionsDlg::OnLangRu()
{
	if(ConfirmLangChange(_T("russian")) == true)
	{
		g_Settings.SetNumeric(nseLanguage, (DWORD)leRussian);
		LangChangedMsg();
	}
}

//////////////////////////////////////////////////////////////////////////
void COptionsDlg::OnLangDe()
{
	if(ConfirmLangChange(_T("german")) == true)
	{
		g_Settings.SetNumeric(nseLanguage, (DWORD)leGerman);
		LangChangedMsg();
	}
}

//////////////////////////////////////////////////////////////////////////
void COptionsDlg::OnLangNl()
{
	if(ConfirmLangChange(_T("dutch")) == true)
	{
		g_Settings.SetNumeric(nseLanguage, (DWORD)leDutch);
		LangChangedMsg();
	}
}

//////////////////////////////////////////////////////////////////////////
void COptionsDlg::OnLangIt()
{
	if(ConfirmLangChange(_T("italian")) == true)
	{
		g_Settings.SetNumeric(nseLanguage, (DWORD)leItalian);
		LangChangedMsg();
	}
}

//////////////////////////////////////////////////////////////////////////
void COptionsDlg::OnLangCz()
{
	if(ConfirmLangChange(_T("czech")) == true)
	{
		g_Settings.SetNumeric(nseLanguage, (DWORD)leCzech);
		LangChangedMsg();
	}
}

//////////////////////////////////////////////////////////////////////////
void COptionsDlg::OnLangDk()
{
	if(ConfirmLangChange(_T("danish")) == true)
	{
		g_Settings.SetNumeric(nseLanguage, (DWORD)leDanish);
		LangChangedMsg();
	}
}

//////////////////////////////////////////////////////////////////////////
void COptionsDlg::OnLangNo()
{
	if(ConfirmLangChange(_T("norwegian")) == true)
	{
		g_Settings.SetNumeric(nseLanguage, (DWORD)leNorwegian);
		LangChangedMsg();
	}
}

//////////////////////////////////////////////////////////////////////////
void COptionsDlg::OnLangSe()
{
	if(ConfirmLangChange(_T("swedish")) == true)
	{
		g_Settings.SetNumeric(nseLanguage, (DWORD)leSwedish);
		LangChangedMsg();
	}
}

//////////////////////////////////////////////////////////////////////////
void COptionsDlg::OnLangEs()
{
	if(ConfirmLangChange(_T("spanish")) == true)
	{
		g_Settings.SetNumeric(nseLanguage, (DWORD)leSpanish);
		LangChangedMsg();
	}
}
